package contegor.scire.core.queries;

import contegor.scire.core.Link;
import contegor.scire.core.Link.Flow;

public class WithFlow extends Condition<Link> {
  private static final long serialVersionUID = 8749156779778990613L;

  public static final WithFlow UPSTREAM = new WithFlow(Flow.UPSTREAM);
  public static final WithFlow NONE = new WithFlow(Flow.NONE);
  public static final WithFlow DOWNSTREAM = new WithFlow(Flow.DOWNSTREAM);
  
  private Flow flow;

  private WithFlow(Flow flow) {
    this.flow = flow;
  }

  @Override
  public boolean eval(Link link) {
    return this.flow == link.getFlow();
  }

  @Override
  public WithFlow clone() {
    return new WithFlow(this.flow);
  }
}
